package com.kksoft.readcm.views;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.text.ClipboardManager;
import android.text.Spanned;
import com.kksoft.readcm.a.Appconfig;
import com.kksoft.readcm.a.c;
import com.kksoft.readcm.a.LoginAppObservable;
import com.kksoft.readcm.activity.App;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

public final class p
  implements Observer
{
  private com.kksoft.readcm.objects.l a;
  private String b;
  private String c;
  private String d;
  private Context e;
  private Spanned f;
  private Spanned g;
  private ProgressDialog h;
  private com.kksoft.readcm.c.b i;
  private PackageManager j;
  private boolean k = false;
  private q l;
  private boolean m = false;

  public p(com.kksoft.readcm.objects.l paraml, Context paramContext, PackageManager paramPackageManager)
  {
    this.a = paraml;
    String str = paraml.k();
    a(str, paramContext, paramPackageManager);
  }

  public p(String paramString1, String paramString2, Context paramContext, PackageManager paramPackageManager)
  {
    this.b = paramString1;
    a(paramString2, paramContext, paramPackageManager);
  }

  private void a(int paramInt)
  {
//    Context localContext1 = this.e;
//    PackageManager localPackageManager1 = this.j;
//    Object localObject1 = new Intent("android.intent.action.SEND");
//    ArrayList localArrayList;
//    Object localObject3;
//    label76: Iterator localIterator;
//    label193: Object localObject5;
//    if (paramInt == 1)
//    {
//      Intent localIntent1 = ((Intent)localObject1).setType("text/plain");
//      localArrayList = new ArrayList();
//      Object localObject2 = null;
//      label276: switch (paramInt)
//      {
//      default:
//        localObject3 = localObject2;
//        if (paramInt == 1)
//        {
//          p localp1 = this;
//          q localq2 = new q(localp1, null, 2, localPackageManager1, localContext1, (String)localObject3);
//          boolean bool1 = localArrayList.add(localq2);
//          p localp2 = this;
//          q localq3 = new q(localp2, null, 1, localPackageManager1, localContext1, (String)localObject3);
//          boolean bool2 = localArrayList.add(localq3);
//          p localp3 = this;
//          q localq4 = new q(localp3, null, 3, localPackageManager1, localContext1, (String)localObject3);
//          boolean bool3 = localArrayList.add(localq4);
//        }
//        List localList = localPackageManager1.queryIntentActivities((Intent)localObject1, 65536);
//        localObject1 = localContext1.getPackageName();
//        localIterator = localList.iterator();
//        if (localIterator.hasNext())
//          break;
//        i locali = new i(this);
//        Collections.sort(localArrayList, locali);
//        Object localObject4 = null;
//        localObject5 = localArrayList.iterator();
//        label230: if (!((Iterator)localObject5).hasNext())
//        {
//          localObject2 = localObject4;
//          label244: if (localObject2 != null)
//          {
//            boolean bool4 = localArrayList.remove(localObject2);
//            localArrayList.add(0, localObject2);
//          }
//          if (paramInt != 2)
//            break label571;
//          int n = 2131165295;
//          if (localArrayList.size() <= 0)
//            break label579;
//          Context localContext2 = this.e;
//          PackageManager localPackageManager2 = this.j;
//          ac localac = new ac(this, localContext2, localPackageManager2, localArrayList);
//          Context localContext3 = this.e;
//          AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(localContext3).setTitle(null);
//          k localk = new k(this, localac, paramInt);
//          AlertDialog.Builder localBuilder2 = localBuilder1.setSingleChoiceItems(localac, -1, localk);
//          j localj = new j(this);
//          AlertDialog localAlertDialog1 = localBuilder2.setOnCancelListener(localj).create();
//          localAlertDialog1.setCanceledOnTouchOutside(1);
//          localAlertDialog1.show();
//        }
//      case 1:
//      case 2:
//      }
//    }
//    while (true)
//    {
//      return;
//      if (paramInt != 2)
//        break;
//      Intent localIntent2 = ((Intent)localObject1).setType("text/html");
//      break;
//      SharedPreferences localSharedPreferences1 = App.h();
//      String str1 = com.kksoft.readcm.d.i.b;
//      localObject3 = localSharedPreferences1.getString("lastShareVia", str1);
//      break label76;
//      SharedPreferences localSharedPreferences2 = App.h();
//      String str2 = com.kksoft.readcm.d.i.c;
//      localObject3 = localSharedPreferences2.getString("lastShareArticleVia", str2);
//      break label76;
//      localObject5 = (ResolveInfo)localIterator.next();
//      String str3 = ((ResolveInfo)localObject5).activityInfo.packageName;
//      if (((String)localObject1).equals(str3))
//        break label193;
//      PackageManager localPackageManager3 = this.j;
//      Context localContext4 = this.e;
//      p localp4 = this;
//      q localq5 = new q(localp4, (ResolveInfo)localObject5, 0, localPackageManager3, localContext4, (String)localObject3);
//      boolean bool5 = localArrayList.add(localq5);
//      break label193;
//      q localq1 = (q)((Iterator)localObject5).next();
//      if (!localq1.e())
//        break label230;
//      break label244;
//      label571: int i1 = 2131165296;
//      break label276;
//      label579: Context localContext5 = this.e;
//      AlertDialog.Builder localBuilder3 = new AlertDialog.Builder(localContext5);
//      String str4 = App.a(i1);
//      AlertDialog.Builder localBuilder4 = localBuilder3.setTitle(str4);
//      String str5 = App.a(2131165299);
//      AlertDialog.Builder localBuilder5 = localBuilder4.setMessage(str5);
//      String str6 = this.e.getString(2131165209);
//      g localg = new g(this);
//      AlertDialog localAlertDialog2 = localBuilder5.setNeutralButton(str6, localg).create();
//      f localf = new f(this);
//      localAlertDialog2.setOnDismissListener(localf);
//      localAlertDialog2.setCanceledOnTouchOutside(1);
//      localAlertDialog2.show();
//    }
  }

  private void a(String paramString, Context paramContext, PackageManager paramPackageManager)
  {
//    this.e = paramContext;
//    com.kksoft.readcm.c.b localb = (com.kksoft.readcm.c.b)paramContext;
//    this.i = localb;
//    this.j = paramPackageManager;
//    if (this.a != null)
//    {
//      str = this.a.c();
//      this.c = str;
//      if (paramString != null)
//        break label73;
//    }
//    label73: for (String str = ""; ; str = paramString)
//    {
//      this.d = str;
//      a(1);
//      return;
//      str = this.b;
//      break;
//    }
  }

  private void a(boolean paramBoolean)
  {
//    if (this.k == paramBoolean);
//    while (true)
//    {
//      return;
//      if (paramBoolean)
//      {
//        this.k = 1;
//        App.a(this);
//        if (this.h != null)
//          continue;
//        ProgressDialog localProgressDialog = ProgressDialog.show(this.e, "", "Loading Article...", 1);
//        this.h = localProgressDialog;
//        this.h.setCancelable(1);
//        continue;
//      }
//      this.k = 0;
//      App.b(this);
//      if (this.h == null)
//        continue;
//      this.h.cancel();
//    }
  }

  private boolean a()
  {
	return false;
//    int n;
//    if ((this.a != null) && (this.a.D() == 1))
//      n = 1;
//    while (true)
//    {
//      return n;
//      if (this.a == null)
//      {
//        c localc = Appconfig.q().e();
//        String str1 = this.b;
//        String str2 = localc.a(str1);
//        if (new File(str2).exists())
//        {
//          n = 1;
//          continue;
//        }
//      }
//      n = 0;
//    }
  }

  private void b()
  {
//    a(1);
//    c localc1;
//    Integer localInteger;
//    if (this.a != null)
//    {
//      localc1 = Appconfig.q().e();
//      localInteger = Integer.valueOf(this.a.a());
//    }
//    c localc2;
//    String str2;
//    for (String str1 = localc1.a(localInteger); ; str1 = localc2.a(str2))
//    {
//      b localb = new b(this, str1);
//      Void[] arrayOfVoid = new Void[0];
//      AsyncTask localAsyncTask = localb.execute(arrayOfVoid);
//      return;
//      localc2 = Appconfig.q().e();
//      str2 = this.b;
//    }
  }

  private void b(int paramInt)
  {
//    q localq = this.l;
//    Object localObject1 = new Intent("android.intent.action.SEND");
//    String str1 = this.d;
//    Intent localIntent1 = ((Intent)localObject1).putExtra("android.intent.extra.TITLE", str1);
//    String str2 = this.d;
//    Intent localIntent2 = ((Intent)localObject1).putExtra("android.intent.extra.SUBJECT", str2);
//    String str3 = App.a(2131165382);
//    String str4;
//    if (paramInt == 2)
//    {
//      Intent localIntent3 = ((Intent)localObject1).setType("text/html");
//      Spanned localSpanned1 = this.f;
//      Intent localIntent4 = ((Intent)localObject1).putExtra("android.intent.extra.TEXT", localSpanned1);
//      str4 = "lastShareArticleVia";
//      switch (localq.h())
//      {
//      default:
//        label124: SharedPreferences.Editor localEditor = App.h().edit();
//        String str5 = localq.g();
//        boolean bool = localEditor.putString(str4, str5).commit();
//        s locals = Appconfig.q().b();
//        String str6 = this.c;
//        String str7 = localq.b();
//        locals.b(str6, str7);
//        if (localq.c() != null)
//          break;
//        int n = localq.d();
//        localObject1 = this.e;
//        switch (n)
//        {
//        default:
//        case 2:
//        case 1:
//        }
//      case 3:
//      case 1:
//      case 2:
//      }
//    }
//    while (true)
//    {
//      d();
//      return;
//      Intent localIntent5 = ((Intent)localObject1).setType("text/plain");
//      String str8 = this.c;
//      Intent localIntent6 = ((Intent)localObject1).putExtra("android.intent.extra.TEXT", str8);
//      str4 = "lastShareVia";
//      break;
//      Intent localIntent7 = ((Intent)localObject1).setType("text/plain");
//      String str9 = this.f.toString();
//      Intent localIntent8 = ((Intent)localObject1).putExtra("android.intent.extra.TEXT", str9);
//      break label124;
//      if (paramInt == 1)
//      {
//        localObject2 = "android.intent.extra.TEXT";
//        localObject3 = new java/lang/StringBuilder;
//        String str10 = this.d;
//        String str11 = this.c;
//        String str12;
//        if (!str10.equals(str11))
//          str12 = String.valueOf(this.d);
//        for (String str13 = str12 + "\n\n"; ; str13 = "")
//        {
//          String str14 = String.valueOf(str13);
//          ((StringBuilder)localObject3).<init>(str14);
//          String str15 = this.c;
//          String str16 = str15 + str3;
//          Intent localIntent9 = ((Intent)localObject1).putExtra((String)localObject2, str16);
//          break;
//        }
//      }
//      Spanned localSpanned2 = this.g;
//      Intent localIntent10 = ((Intent)localObject1).putExtra("android.intent.extra.TEXT", localSpanned2);
//      break label124;
//      Intent localIntent11 = ((Intent)localObject1).putExtra("android.intent.extra.TITLE", "");
//      Intent localIntent12 = ((Intent)localObject1).putExtra("android.intent.extra.SUBJECT", "");
//      str3 = "android.intent.extra.TEXT";
//      Object localObject2 = new java/lang/StringBuilder;
//      String str17 = this.d;
//      String str18 = this.c;
//      String str19;
//      if (!str17.equals(str18))
//        str19 = String.valueOf(this.d);
//      for (Object localObject3 = str19 + " "; ; localObject3 = "")
//      {
//        String str20 = String.valueOf(localObject3);
//        ((StringBuilder)localObject2).<init>(str20);
//        String str21 = this.c;
//        String str22 = str21;
//        Intent localIntent13 = ((Intent)localObject1).putExtra(str3, str22);
//        break;
//      }
//      Uri localUri = Uri.parse(this.c.replaceFirst("browser::", ""));
//      Intent localIntent14 = new Intent("android.intent.action.VIEW", localUri);
//      Intent localIntent15 = localIntent14.addFlags(524288);
//      ((Context)localObject1).startActivity(localIntent14);
//      continue;
//      ClipboardManager localClipboardManager = (ClipboardManager)((Context)localObject1).getSystemService("clipboard");
//      String str23 = this.c;
//      localClipboardManager.setText(str23);
//      continue;
//      String str24 = localq.c().activityInfo.applicationInfo.packageName;
//      String str25 = localq.c().activityInfo.name;
//      ComponentName localComponentName = new ComponentName(str24, str25);
//      Intent localIntent16 = ((Intent)localObject1).setComponent(localComponentName);
//      Intent localIntent17 = ((Intent)localObject1).addFlags(524288);
//      this.e.startActivity((Intent)localObject1);
//    }
  }

  private void c()
  {
//    a(0);
//    Context localContext = this.e;
//    AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(localContext).setTitle("Cannot Email Article").setMessage("The article view is not available for this page");
//    n localn = new n(this);
//    AlertDialog.Builder localBuilder2 = localBuilder1.setNeutralButton("Ok", localn);
//    m localm = new m(this);
//    AlertDialog.Builder localBuilder3 = localBuilder2.setPositiveButton("Share as Link", localm);
//    l locall = new l(this);
//    AlertDialog localAlertDialog = localBuilder3.setOnCancelListener(locall).create();
//    localAlertDialog.setCanceledOnTouchOutside(1);
//    localAlertDialog.show();
  }

  private void d()
  {
//    this.m = 1;
//    com.kksoft.readcm.c.b localb = this.i;
//    com.kksoft.readcm.objects.l locall = this.a;
//    String str1 = this.b;
//    String str2 = this.d;
//    localb.a(0, locall, str1, str2);
  }

  public final void update(Observable paramObservable, Object paramObject)
  {
//    if (!this.k);
//    while (true)
//    {
//      return;
//      com.kksoft.readcm.objects.h localh = com.kksoft.readcm.objects.h.a(paramObject);
//      if ((localh.a() != 12) && (localh.a() != 36))
//        continue;
//      //App.a(new h(this, localh));
//    }
  }
}

/* Location:           E:\AndroidDecompiler\jd-gui-0.3.3.windows\newrclasses.dex.dex2jar.jar
 * Qualified Name:     com.kksoft.readcm.views.p
 * JD-Core Version:    0.6.0
 */